package com.oocl.eventListener;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JFrame;
import javax.swing.JRadioButton;

import com.oocl.tm.ui.ChatFrame;

public class RadioButtonListener implements ActionListener{
	
	private ChatFrame chatWindow;
	private String name;
	
	public RadioButtonListener(ChatFrame chatWindow,String name){
		this.chatWindow = chatWindow;
		this.name = name;
	}

	public void actionPerformed(ActionEvent e) {
		JRadioButton btn = (JRadioButton) e.getSource();
		String receiver = btn.getText();
		
		chatWindow.setTitle(name + " to " + receiver);
		
		chatWindow.setReceiver(receiver);
		
	}

}
